package com.linq.cool.api.feign;

import com.linq.cool.api.dto.SysUserLastLoginDTO;
import com.linq.cool.api.factory.RemoteSysUserFallbackFactory;
import com.linq.cool.api.vo.LoginUser;
import com.linq.cool.common.constants.ServiceNameConstants;
import com.linq.cool.common.core.domain.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author: yqlin
 * @Date: 2021/1/17 05:09
 * @Description: 用户服务
 * @Version: 1.0.0
 */
@FeignClient(contextId = "remoteSysUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSysUserFallbackFactory.class)
public interface RemoteSysUserService {
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     *
     * @return 结果
     */
    @GetMapping(value = "/user/info/{username}")
    Result<LoginUser> getUserInfo(@PathVariable("username") String username);

    /**
     * 根据用户id更细用户信息
     *
     * @param dto 最后登录信息
     *
     * @return 结果
     */
    @PutMapping("/user/updateLoginInfo")
    Result<?> updateLoginInfo(@RequestBody SysUserLastLoginDTO dto);

}
